package win.ganbo.ssm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import win.ganbo.ssm.service.IUserService;
import win.ganbo.ssm.utils.Result;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

/**
 *
 * @Author ganbo E-mail:bo.gan@56qq.com
 * @CreateTime 2017-08-01 21:14
 */
@Controller
public class IndexController {

    @Autowired
    private IUserService userService;

    @GetMapping("/index")
    public String index(){
        return "index";
    }

    @RequestMapping("/async")
    @ResponseBody
    public Result asyncTest() throws ExecutionException, InterruptedException {
        Future<String> sf = userService.asyncTest();
        System.out.println("sf====>"+sf.get());

        System.out.println("*************controller已经返回去了。。。。");
        return new Result();
    }




}
